<link rel="stylesheet" href="<?php echo base_path() ?>plupload/style/style.css" />
<script type="text/javascript" src="<?php echo base_path() ?>plupload/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="<?php echo base_path() ?>plupload/js/plupload.js"></script>
<script type="text/javascript" src="<?php echo base_path() ?>plupload/js/plupload.flash.js"></script>
<script type="text/javascript" src="<?php echo base_path() ?>plupload/js/plupload.html5.js"></script>        
<script type="text/javascript" src="<?php echo base_path() ?>plupload/js/script.js"></script>

<a id="pickfiles" href="javascript:;">[Chon Anh]</a>
<div id="thumbnails">
    <?php
        if(!empty($data['picture'])) {
            foreach($data['picture'] as $pic) {
    ?>
    <div class="thumb" id="thumb_<?php echo $pic['fid'] ?>"><div class="thumb_cell"><img title="" alt="" src="/plupload/lib/phpThumb/phpThumb.php?src=/files/products/<?php echo $pic['filepath'] ?>&amp;w=100&amp;h=100&amp;q=100"><a class="remove" id="<?php echo $pic['fid'] ?>" filename="<?php echo $pic['filepath'] ?>" title="Xóa ảnh"></a></div></div>
    
    <?php            
            }
    ?>
    <script type="text/javascript">
    $(function(){
        settings.max_file_temp = <?php echo count($data['picture']); ?>;
    });
    </script>
    <?php        
        }
    ?>
</div>
<input type="hidden" id="thumbnail" name="thumbnail" readonly="true" />
<script type="text/javascript">
$(function(){
    $('a.remove').each(function(){
        removeImage($(this).attr('id'), 'files/products');
    });
    settings.max_file_upload = 10;//so anh cho pheo
    settings.upload_path = 'files/products'; //path
    settings.url = '/upload.php?path=' + settings.upload_path + '&action=products&f=true&uid=<?php echo $user->uid ?>&pid=<?php echo arg(2) ?>';
    settings.create_thumb = true;
    
    uploader = new plupload.Uploader(settings);
    uploader.init();
});
</script>